# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=pathlib2
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}"
         "${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=2.3.0
pkgrel=2
pkgdesc="This module offers a set of classes featuring all the common operations on paths in an easy, object-oriented way (mingw-w64)"
url="https://pathlib.readthedocs.io/en/${pkgver}/"
arch=('any')
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools")
_dtoken="a1/14/df0deb867c2733f7d857523c10942b3d6612a1b222502fdffa9439943dfb"
source=("https://pypi.python.org/packages/${_dtoken}/${_realname}-${pkgver}.tar.gz")
sha256sums=('d32550b75a818b289bd4c1f96b60c89957811da205afcceab75bc8b4857ea5b3')

prepare() {
  cp -a ${_realname}-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  python3 setup.py build

  cd ${srcdir}/${_realname}-${pkgver}-py2
  python2 setup.py build
}

package_python3-pathlib2() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3"
           "${MINGW_PACKAGE_PREFIX}-python3-scandir")

  cd ${srcdir}/${_realname}-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE.rst "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE.txt"
}

package_python2-pathlib2() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2"
           "${MINGW_PACKAGE_PREFIX}-python2-scandir")

  cd ${srcdir}/${_realname}-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -Dm644 LICENSE.rst "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE.txt"
}

package_mingw-w64-i686-python2-pathlib2() {
  package_python2-pathlib2
}

package_mingw-w64-i686-python3-pathlib2() {
  package_python3-pathlib2
}

package_mingw-w64-x86_64-python2-pathlib2() {
  package_python2-pathlib2
}

package_mingw-w64-x86_64-python3-pathlib2() {
  package_python3-pathlib2
}

# vim:set ts=2 sw=2 et:
